//
//  OrderPingJiaTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/8/9.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "OrderPingJiaTableViewCell.h"

@implementation OrderPingJiaTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    
    UIView *goodsView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, rateHeight(180))];
    goodsView.backgroundColor = UIColorFromRGB(0xf5f5f5);
    [self addSubview:goodsView];
    
    self.goodsImg = [[UIImageView alloc] init];
    _goodsImg.image = UIImageNamed(@"salesGoods");
    [goodsView addSubview:_goodsImg];
    [_goodsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(goodsView).offset(rateWidth(30));
        make.centerY.equalTo(goodsView);
        make.size.mas_offset(CGSizeMake(rateWidth(150), rateWidth(150)));
    }];
    
    self.goodsTitleLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x323232) fontSize:15];
    _goodsTitleLB.numberOfLines = 0;
    [goodsView addSubview:self.goodsTitleLB];
    [_goodsTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.goodsImg.mas_right).offset(rateWidth(20));
        make.width.lessThanOrEqualTo(@(rateWidth(400)));
        make.top.equalTo(weakSelf.goodsImg).offset(rateHeight(10));
        make.height.mas_lessThanOrEqualTo(@(rateHeight(100)));
    }];
    
    self.priceLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x323232) fontSize:15];
    [_priceLB sizeToFit];
    [goodsView addSubview:_priceLB];
    [_priceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(goodsView).offset(-rateWidth(30));
        make.top.equalTo(weakSelf.goodsImg).offset(rateHeight(10));
    }];
    
    self.describeLB = [UILabel labelWithText:@"" textColor:UIColorFromRGB(0x909090) fontSize:15];
    [_describeLB sizeToFit];
    [goodsView addSubview:_describeLB];
    [_describeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.goodsTitleLB);
        make.top.equalTo(weakSelf.goodsTitleLB.mas_bottom).offset(rateHeight(15));
    }];
    
    self.numLB = [UILabel labelWithText:@"×1" textColor:UIColorFromRGB(0x909090) fontSize:15];
    [_numLB sizeToFit];
    [goodsView addSubview:_numLB];
    [_numLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf.priceLB);
        make.top.equalTo(weakSelf.priceLB.mas_bottom).offset(rateHeight(25));
    }];
    
    UIButton *btn1 = [UIButton buttonWithTitle:@"售后" fontSize:15 titleColor:UIColorWhite background:navBarColor cornerRadius:3];
    [self addSubview:btn1];
    [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-rateWidth(30));
        make.size.mas_offset(CGSizeMake(rateWidth(180), rateHeight(70)));
        make.top.equalTo(goodsView.mas_bottom).offset(rateHeight(30));
    }];
    self.shouHouBtn = btn1;
    
    UIButton *btn2 = [UIButton buttonWithTitle:@"评价" fontSize:15 titleColor:UIColorFromRGB(0x3b3b3b) background:UIColorFromRGB(0xf5f5f5) cornerRadius:3];
    [self addSubview:btn2];
    [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(btn1.mas_left).offset(-rateWidth(40));
        make.size.mas_offset(CGSizeMake(rateWidth(180), rateHeight(70)));
        make.centerY.equalTo(btn1);
    }];
    self.pingJiaBtn = btn2;
}

@end
